﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace YBOT_Field_Control
{

    public enum pin
    {
        //Light Pins
        red = 1,
        green = 2,
        yellow = 3,
        blue = 4,

        //Tower States
        redOnlyByte = 0x01,
        greenOnlyByte = 0x02,
        yellowOnlyByte = 0x04,
        blueOnlyByte = 0x08,
        autoRelayOnlyByte = 0x16,
        manRelayOnlyByte = 0x32,
        allOffByte = 0x00,

        //Input Pins
        input1 = 7,
        input2 = 8,

        //Control Board pins
        bell = 2,                //Bell relay
        buzzer = 3,              //Buzzer relay
        controlBoard = 0,           //Control Board tower number

        //Driver Controls
        redTeam_Node = 3,           //Red team's controller Node    
        greenTeam_Node = 7,         //Green teams' controller Node
        transmitterRelay = 5,    //Controller relay number - Enable / Disable
        auto_driverRelay = 6,    //Autonomous Mode relay = Auto / Manual 
    };

    /// <summary>
    /// Common Team Variables
    /// </summary>
    public class TeamVariables
    {
        private Time tvTime = new Time();
        private Field_Control tvFC = new Field_Control();

        //public Variables
        public string teamColor = null;        //Team color "red" or "green"
        public int score = 0;               //Team's score
        public int autoCount = 0;           //Autonomous Mode Counter
        public int finalScore = 0;          //Team's final score
        public int penalty = 0;             //Penalty amount
        public bool dq = false;                 //Team DQ flag
        public string matchResult = null;      //Match Result string
        public bool autoFinished = false;       //Autonomous mode finished flag
        public int autoScore = 0;           //Autonomous mode score
        public int midScore = 0;            //Middle round score
        public int endGameScore = 0;        //End of game score




        //------------------------------------------------------------------------------------------------\\
        //Current year's game variables
        //------------------------------------------------------------------------------------------------\\

        //public int rows = 0;              //Number of tic-tac-toe rows
        //public bool king = false;         //King of the hill
        //public int startSpot = 0;         //Starting locating
        //public bool newButtonState = false;   //Flag for checking the state of the button
        //public bool oldButtonState = false;
        //public int lightScore = 0;        //Number of lights lit at the end of game
        //public int ballScore = 0;         //Number of balls scored at end of game
        public bool autoBonus = false;    //Autobonus flag
        public int autoBall = 0;          //Number of balls counted in autoMode
        public bool scored = false;       //Flag for indication if a team has scored
        public int autoBonusValue = 0;          //Bonus for starting spot
        public int midFieldBonus = 0;       //Bonus score for mid field

        public bool tower1 = false;
        public bool tower2 = false;
        public bool tower3 = false;
        public bool tower4 = false;
        public bool tower5 = false;
        public bool tower6 = false;
        public bool tower7 = false;
        public bool tower8 = false;

        public int autoLightsScore = 0;
        public int autoBonusScore = 0;
        public int midBonusScore = 0;
        public int rowsSore = 0;
        public int protonsScore = 0;
        public int endLightsScore = 0;


        /// <summary>
        /// Resets variable
        /// </summary>
        public void reset()
        {
            this.score = 0;
            this.autoCount = 0;
            this.finalScore = 0;
            this.penalty = 0;
            this.dq = false;
            this.matchResult = null;
            this.autoFinished = false;
            this.autoScore = 0;
            this.midScore = 0;
            this.endGameScore = 0;


            this.autoBonus = false;
            this.autoBall = 0;
            this.scored = false;
            //this.autoBonusValue = 0;
            this.midFieldBonus = 0;

            this.tower1 = false;
            this.tower2 = false;
            this.tower3 = false;
            this.tower4 = false;
            this.tower5 = false;
            this.tower6 = false;
            this.tower7 = false;
            this.tower8 = false;

            this.autoLightsScore = 0;
            this.autoBonusScore = 0;
            this.midBonusScore = 0;
            this.rowsSore = 0;
            this.protonsScore = 0;
            this.endLightsScore = 0;


            //this.lightScore = 0;
            //this.ballScore = 0;
            //this.newButtonState = false;
            //this.oldButtonState = false;
            //this.rows = 0;
            //this.king = false;
            //this.startSpot = 0;
        }

    }

}
